package org.example.service.yy.ServiceImpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.models.auth.In;
import org.example.entity.yy.Attractions;
import org.example.mapper.AttractionsMapper;
import org.example.service.yy.AttractionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AttractionsServiceImpl extends ServiceImpl<AttractionsMapper, Attractions> implements AttractionsService {

    @Autowired
    private AttractionsMapper attractionsMapper;

    @Override
    public List<Attractions> selectAttractionsByCityId(int cityId) {
        return attractionsMapper.selectAttractionsByCityId(cityId);
    }


    public PageInfo<Attractions> selectAttractionsByPage(int start, int pageSize,int uid, String address, String topic, String star,String attName) {
        PageHelper.startPage(start, pageSize);
        List<Attractions> attractionsList = attractionsMapper.selectAttractionsByPage(uid,address,topic,star,attName);
        return new PageInfo<>(attractionsList);
    }

    //根据传入景点Id查询景点详情
    @Override
    public Attractions selectAttractionsById(Integer attId) {
        return attractionsMapper.selectAttractionsById(attId);
    }

    //根据景点id修改浏览量
    @Override
    public Integer updateViewsById(Integer attId) {
        return attractionsMapper.updateViewsById(attId);
    }
}
